﻿<UserControl x:Class="Views.ViewDonneesEconomiques"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"             
             xmlns:System="clr-namespace:System;assembly=mscorlib"
             xmlns:VMtxgar="clr-namespace:OMANE.Modules.TauxGarantis.ViewModels"
             xmlns:Theme="clr-namespace:OMANE.Common.UI.Theme;assembly=OMANE.Common.UI.Theme"
             DataContext="{Binding Source={x:Static VMtxgar:Locator.ViewModelDonneesEconomiquesStatic}}"
             mc:Ignorable="d"             
             >
	<UserControl.Resources>
		<Thickness x:Key="EntryGridMargin">0,2</Thickness>
		<Thickness x:Key="EntryLabelMargin">0,0,5,0</Thickness>
		<HorizontalAlignment x:Key="EntryLabelHorizontalAlignment">Right</HorizontalAlignment>
		<VerticalAlignment x:Key="EntryLabelVerticalAlignment">Center</VerticalAlignment>
		<Thickness x:Key="EntryValueMargin">5,0,0,0</Thickness>
		<VerticalAlignment x:Key="EntryValueVerticalAlignment">Center</VerticalAlignment>
		<HorizontalAlignment x:Key="EntryValueHorizontalAlignment">Left</HorizontalAlignment>
		<System:Double x:Key="EntryValueWidth">149</System:Double>
	</UserControl.Resources>
     
	<StackPanel>
		<GroupBox Style="{DynamicResource OMANE_GpeBox}" Header="Hypothèse  économiques" Focusable="True" IsTabStop="True" TabIndex="0">
			<StackPanel HorizontalAlignment="Center" Margin="0,10" >
                
                <!-- Taxe d'assurance -->
				<UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2">
                    <UniformGrid.Visibility>
                        <Binding Path="TaxeDassurance_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Taxe d'assurance" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding TaxeDassurance, UpdateSourceTrigger=LostFocus}"/>
                </UniformGrid>
                
                <!-- Taux technique annuel -->
				<UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="TauxTechniqueAnnuel_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Taux technique annuel" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding TauxTechniqueAnnuel, UpdateSourceTrigger=LostFocus}" />
                </UniformGrid>
                
                <!-- Taux annuel de remboursements anticipés -->
				<UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="TauxRemboursementAnticipe_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Taux annuel de remboursement anticipé" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding TauxRemboursementAnticipe, UpdateSourceTrigger=LostFocus}" />
                </UniformGrid>

                <!-- Taux de rendement annuel des actifs -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="TauxRendementActifs_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Taux de rendement annuel des actifs" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding TauxRendementActifs, UpdateSourceTrigger=LostFocus}" />
                </UniformGrid>

                <!-- Taux annuel d'imposition -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="TauxImposition_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Taux annuel d'imposition" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding TauxImposition, UpdateSourceTrigger=LostFocus}" />
                </UniformGrid>

                <!-- Taux de rendement annuel exigé par les actionnaires -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="TauxExigeActionnaires_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Taux de rendement annuel exigé par les actionnaires" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding TauxExigeActionnaires, UpdateSourceTrigger=LostFocus}"/>
                </UniformGrid>

                <!-- Cout annuel des emprunts subordonnés -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" >
                    <UniformGrid.Visibility>
                        <Binding Path="CoutAnnuelEmpruntsSubordonnes_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Cout annuel des emprunts subordonnés" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding CoutAnnuelEmpruntsSubordonnes, UpdateSourceTrigger=LostFocus}" />
                </UniformGrid>
                
			</StackPanel>  	
		</GroupBox>
        
		<GroupBox Style="{DynamicResource OMANE_GpeBox}" Header="Pilotage du contrat" >
			<StackPanel Margin="0,10" >

                <!-- Grille tarifaire -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" d:LayoutOverrides="Width" >
                    <UniformGrid.Visibility>
                        <Binding Path="GrilleTarifaire_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Grille tarifaire" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <ComboBox 
                        Width="{DynamicResource EntryValueWidth}" 
                        Margin="{DynamicResource EntryValueMargin}" 
                        HorizontalAlignment="{DynamicResource EntryValueHorizontalAlignment}" 
                        VerticalAlignment="{DynamicResource EntryValueVerticalAlignment}" 
                        Style="{DynamicResource OMANE_cbx}" 
                        ItemsSource="{Binding GrilleTarifaires, Mode=OneWay}" 
                        SelectedItem="{Binding GrilleTarifaireSelectionne}" >
                        <ComboBox.ItemTemplate>
                            <DataTemplate>
                                <TextBlock  Text="{Binding Path=NomTable}" />                              
                            </DataTemplate>
                        </ComboBox.ItemTemplate>
                        <ComboBox.ItemContainerStyle>
                            <Style TargetType="{x:Type ComboBoxItem}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type ContentControl}">
                                            <TextBlock  Text="{Binding Path=NomTable}" Background="{TemplateBinding Background}" />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                                <Style.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter Property="Foreground" Value="Red" />
                                    </Trigger>
                                    <Trigger Property="IsHighlighted" Value="True">
                                        <Setter Property="Foreground" Value="White" />
                                        <Setter Property="Background" Value="Violet" />
                                    </Trigger>
                                </Style.Triggers>
                            </Style>
                        </ComboBox.ItemContainerStyle>
                    </ComboBox>
                </UniformGrid>

                <!-- Frais de gestion annuels -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" d:LayoutOverrides="Width" >
                    <UniformGrid.Visibility>
                        <Binding Path="FraisGestion_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Frais de  gestion annuels" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding FraisGestion, UpdateSourceTrigger=LostFocus}" />
                </UniformGrid>

                <!-- Taux de couverture par des emprunts subordonnés -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" d:LayoutOverrides="Width" >
                    <UniformGrid.Visibility>
                        <Binding Path="TauxEmpruntsSubordonnes_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Taux de couverture par des emprunts subordonnés" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding TauxEmpruntsSubordonnes, UpdateSourceTrigger=LostFocus}" />
                </UniformGrid>

                <!-- Ratio fonds propres alloués / MSR -->
                <UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" d:LayoutOverrides="Width" >
                    <UniformGrid.Visibility>
                        <Binding Path="RatioFondsSurMSR_IsUsed">
                            <Binding.Converter>
                                <BooleanToVisibilityConverter />
                            </Binding.Converter>
                        </Binding>
                    </UniformGrid.Visibility>
					<TextBlock Text="Ratio fonds propres alloués / MSR" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Style="{StaticResource PercentageEditor}" Value="{Binding RatioFondsSurMSR, UpdateSourceTrigger=LostFocus}" />
                </UniformGrid>
                
                <!--<UniformGrid Margin="{DynamicResource EntryGridMargin}" Columns="2" d:LayoutOverrides="Width" >
                    <TextBlock Text="Ratio fonds propres alloués / MSR" Margin="{DynamicResource EntryLabelMargin}" HorizontalAlignment="{DynamicResource EntryLabelHorizontalAlignment}" VerticalAlignment="{DynamicResource EntryLabelVerticalAlignment}" />
                    <Theme:NumericEditor Value="{Binding RatioFondsSurMSR}" Style="{StaticResource PercentageEditor}"  />
                </UniformGrid>-->
            </StackPanel>
		</GroupBox> 
	</StackPanel>
</UserControl>
